package 编程能力入门1;

public class _13缀点成线 {
    public boolean checkStraightLine(int[][] coordinates) {
        int len = coordinates.length;
        if (len == 2) {
            return true;
        }
        int a = coordinates[0][0], b = coordinates[0][1];
        for (int i = 2; i < len; i++) {
            int[] cur = coordinates[i];
            int[] last = coordinates[i - 1];
            if ((cur[1] - b) * (last[0] - a) != (cur[0] - a) * (last[1] - b)) {
                return false;
            }
        }
        return true;
    }
}
